<#include "/inc/layout.ftl"/>
<@layout "帖子">
    <#include "/inc/panel.ftl"/>
<#--中间部分-->
    <div class="layui-container">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md8">
                <div class="fly-panel" style="margin-bottom: 0;">

                    <div class="fly-panel-title fly-filter">
                        <a href="/post/category/${cid}?status=0" class="${(status==0)?string('layui-this','')}">综合</a>
                        <span class="fly-mid"></span>
                        <a href="/post/category/${cid}?status=1" class="${(status==1)?string('layui-this','')}">未结</a>
                        <span class="fly-mid"></span>
                        <a href="/post/category/${cid}?status=2" class="${(status==2)?string('layui-this','')}">已结</a>
                        <span class="fly-mid"></span>
                        <a href="" >精华</a>
                        <span class="fly-filter-right layui-hide-xs">
            <a href="/post/category/${cid}?status=${status}&order=created" class="${(order=='created')?string('layui-this','')}">按最新</a>
            <span class="fly-mid"></span>
            <a href="/post/category/${cid}?status=${status}&order=p.comment_count" class="${(order=='p.comment_count')?string('layui-this','')}">按热议</a>
          </span>
                    </div>

                    <ul class="fly-list">
                        <@posts1 categoryId=cid pn=pn size=2 status=status order=order>
                            <#list results.records as postvo>
                                <@postlist postvo>

                                </@postlist>
                            </#list>
                            <div style="text-align: center">
                                <div id="laypage-main">
                                </div>
                                <script>
                                    layui.use('laypage', function(){
                                        var laypage = layui.laypage;

                                        //执行一个laypage实例
                                        laypage.render({
                                            elem: 'laypage-main'
                                            ,count: ${results.total}
                                            ,limit: ${results.size}
                                            ,curr: ${results.current}
                                            ,jump: function(obj, first){
                                                console.log(${status});
                                                //obj包含了当前分页的所有参数，比如：
                                                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                                                console.log(obj.limit); //得到每页显示的条数
                                                //首次不执行
                                                if(!first){
                                                    var url="?pn="+obj.curr+"&status=${status}&order=${order}";
                                                    console.log(url);
                                                    location.href="?pn="+obj.curr+"&status=${status}&order=${order}";
                                                }
                                            }
                                        });
                                    });
                                </script>
                            </div>
                        </@posts1>
                    </ul>

                    <!-- <div class="fly-none">没有相关数据</div> -->


                </div>
            </div>
            <div class="layui-col-md4">
                <dl class="fly-panel fly-list-one">
                    <dt class="fly-panel-title">本周热议</dt>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>
                    <dd>
                        <a href="">基于 layui 的极简社区页面模版</a>
                        <span><i class="iconfont icon-pinglun1"></i> 16</span>
                    </dd>

                    <!-- 无数据时 -->
                    <!--
                    <div class="fly-none">没有相关数据</div>
                    -->
                </dl>

                <div class="fly-panel">
                    <div class="fly-panel-title">
                        这里可作为广告区域
                    </div>
                    <div class="fly-panel-main">
                        <a href="" target="_blank" class="fly-zanzhu" style="background-color: #393D49;">虚席以待</a>
                    </div>
                </div>

                <div class="fly-panel fly-link">
                    <h3 class="fly-panel-title">友情链接</h3>
                    <dl class="fly-panel-main">
                        <dd><a href="http://www.layui.com/" target="_blank">layui</a><dd>
                        <dd><a href="http://layim.layui.com/" target="_blank">WebIM</a><dd>
                        <dd><a href="http://layer.layui.com/" target="_blank">layer</a><dd>
                        <dd><a href="http://www.layui.com/laydate/" target="_blank">layDate</a><dd>
                        <dd><a href="mailto:xianxin@layui-inc.com?subject=%E7%94%B3%E8%AF%B7Fly%E7%A4%BE%E5%8C%BA%E5%8F%8B%E9%93%BE" class="fly-link">申请友链</a><dd>
                    </dl>
                </div>

            </div>
        </div>
    </div>
</@layout>
